package lab02.test06;

public class Triangle {
    private double a;
    private double b;
    private double c;
    private boolean temp;
    private double area;
    private double perimeter;



    public Triangle(){}

    public Triangle(double a,double b,double c,boolean temp,double area,double perimeter){
        this.a=a;
        this.b=b;
        this.c=c;
        this.temp=temp;
        this.area=area;
        this.perimeter=perimeter;
    }

    public double getArea(double a,double b,double c) {
        double s=(a+b+c)/2;
        double x=s*(s-a)*(s-b)*(s-c);
        area=(double) Math.sqrt(x);
        return area;
    }

    public void setArea(double area) {
        this.area = area;
    }

    public double getPerimeter(double a,double b,double c) {
        perimeter=a+b+c;
        return perimeter;
    }

    public void setPerimeter(double perimeter) {
        this.perimeter = perimeter;
    }

    public double getA() {
        return a;
    }

    public void setA(double a) {
        this.a = a;
    }

    public double getB() {
        return b;
    }

    public void setB(double b) {
        this.b = b;
    }

    public double getC() {
        return c;
    }

    public void setC(double c) {
        this.c = c;
    }

    public boolean isTemp(double a,double b,double c) {

        if (a+b>c&&a+c>b&&b+c>a){
            temp=true;
        }else{
            System.out.println("不能构成三角形！");
        }
        return temp;
    }

    public void setTemp(boolean temp) {
        this.temp = temp;
    }


}
